home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
flashpc.exe
/
DISKDEMO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-25
|
2KB
|
77 lines
#include <fpclib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
void TestDosErrNo( void );
char Buf[20000];
FILE Text;
long int FilSize;
int Handle,NBytes,WBytes;
char Done,Ch;
void TestDosErrNo( void )
{
int rc = 0;
if ( DosErrNo || CErrCode ) {
printf( "DosErrNo = %d \n", DosErrNo );
printf( "CErrCode = %d \n", CErrCode );
printf( "CErrType = %d \n", CErrType );
printf( "CErrDrive = %d \n", CErrDrive );
printf( "CErrDevice = %s \n\n", CErrDevice );
ResetErrCodes();
rc++;
}
printf("\nPress Enter to continue...");
GetKey();
printf( "\n" );
}
void main( void )
{
VioInit();
GotoxyAbs( 1, 1 );
memset( Buf, 'A', sizeof( Buf ) );
ClrWin( 1, 1, 80, 25, 7 );
SetInt24();
printf( "doing createfile\n" );
CreateFile( "a:Test", 0, &Handle );
TestDosErrNo();
printf( "doing writefile\n" );
WriteFile( Handle, sizeof( Buf ), Buf, &WBytes );
TestDosErrNo();
printf( "doing closefile\n" );
CloseFile( Handle );
TestDosErrNo();
printf( "doing openfile\n" );
OpenFile( "A:Test", 2, &Handle );
TestDosErrNo();
printf( "doing FSeek\n" );
printf( "FilSize = %ld\n", FSeek( Handle, 0, 15100L ) );
TestDosErrNo();
printf( "doing FSeek again...\n" );
printf( "FilSize = %ld\n", FSeek( Handle, 0, 0L ) );
TestDosErrNo();
printf( "do ReadFile\n" );
ReadFile( Handle, sizeof( Buf ), Buf, &WBytes );
TestDosErrNo();
printf( "Number of bytes read = %u\n", WBytes );
printf( "do CloseFile\n" );
CloseFile( Handle );
TestDosErrNo();
}